package util;

import java.util.Random;

/**
 * UserRank: tum0r
 * Package Name: util
 * Time: 2019-01-26 Saturday 20:55:34
 */
public class RandomPassword {
    public String getPassword() {
        StringBuilder result = new StringBuilder();
        Random random = new Random();
        int size = 8;
        int x;
        for (int i = 0; i < size; i++) {
            x = random.nextInt(3);
            switch (x) {
                case 0:
                    result.append((char) ('0' + random.nextInt(10)));
                    break;
                case 1:
                    result.append((char) ('A' + random.nextInt(26)));
                    break;
                case 2:
                    result.append((char) ('a' + random.nextInt(26)));
                    break;
            }
        }
        return result.toString();
    }
}
